<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Perform an Apache sub-request</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.getallheaders.html">getallheaders</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="book.fpm.html">FastCGI 进程管理器</a></div>
 <div class="up"><a href="ref.apache.html">Apache 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.virtual" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">virtual</h1>
  <p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">virtual</span> &mdash; <span class="dc-title">Perform an Apache sub-request</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.virtual-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">bool</span> <span class="methodname"><strong>virtual</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$filename</code></span>
   )</div>

  <p class="para rdfs-comment">
   <span class="function"><strong>virtual()</strong></span> is an Apache-specific function which
   is similar to <em>&lt;!--#include virtual...--&gt;</em> in
   <em>mod_include</em>.
   It performs an Apache sub-request.  It is useful for including
   CGI scripts or <var class="filename">.shtml</var> files, or anything else that you would
   parse through Apache. Note that for a CGI script, the script
   must generate valid CGI headers.  At the minimum that means it
   must generate a <em>Content-Type</em> header.
  </p>
  <p class="para">
   To run the sub-request, all buffers are terminated and flushed to the
   browser, pending headers are sent too.
  </p>
  <p class="simpara">、
仅在将 PHP 安装为 Apache 模块时，支持此函数。</p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.virtual-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<em><code class="parameter">filename</code></em></dt>

     <dd>

      <p class="para">
       The file that the virtual command will be performed on.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.virtual-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Performs the virtual command on success, or returns <strong><code>FALSE</code></strong> on failure.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.virtual-changelog">
  <h3 class="title">更新日志</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>版本</th>
       <th>说明</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>4.3.3</td>
       <td>
        <p class="para">从
PHP 4.3.3 起，也可在 Netscape/iPlanet/SunONE Web 服务器的 
<a href="book.nsapi.html" class="link">NSAPI 服务器模块</a>使用此函数。</p>
       </td>
      </tr>

      <tr>
       <td>4.0.6</td>
       <td>
        This function may be used on PHP files. However, it is typically
        better to use <span class="function"><a href="function.include.html" class="function">include</a></span> or
        <span class="function"><a href="function.require.html" class="function">require</a></span> for PHP files.
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.virtual-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   See <span class="function"><a href="function.apache-note.html" class="function">apache_note()</a></span> for an example.
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.virtual-notes">
  <h3 class="title">注释</h3>
  <div class="warning"><strong class="warning">Warning</strong>
   <p class="para">
    The query string can be passed to the included file but
    <var class="varname"><var class="varname"><a href="reserved.variables.get.html" class="classname">$_GET</a></var></var> is copied from the parent script and only
    <var class="varname"><var class="varname"><a href="reserved.variables.server.html" class="classname">$_SERVER['QUERY_STRING']</a></var></var> is filled with the passed
    query string. The query string may only be passed when using Apache 2.
    The requested file will not be listed in the Apache access log.
   </p>
  </div>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    Environment variables set in the requested file are not visible to the
    calling script.
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.virtual-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="function.apache-note.html" class="function" rel="rdfs-seeAlso">apache_note()</a> - 取得或设置 apache 请求记录</span></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.getallheaders.html">getallheaders</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="book.fpm.html">FastCGI 进程管理器</a></div>
 <div class="up"><a href="ref.apache.html">Apache 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
